package cn.gson.zuche.controller.admin;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.UUID;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;

import cn.gson.zuche.model.bean.Weburl;

public class Uploadpohto extends HttpServlet{
	private String fileSavePath = "D:\\workspace\\gitlx\\zuche22\\WebContent\\static\\img";
public String updaload(Part part,HttpServletResponse resp) throws IOException{
	PrintWriter pw = resp.getWriter();
	String shuf = null;
	shuf = part.getSubmittedFileName().substring(part.getSubmittedFileName().lastIndexOf("."));
	String newFileName = UUID.randomUUID().toString().replace("-", "") + shuf;
	String absFilePath = fileSavePath + File.separator + newFileName;
	part.write(absFilePath);
	String displayPath = absFilePath.replace(this.fileSavePath, "");
	return newFileName;
}
}
